Problem with Expires

Problem with Expires

am 08.03.2010 06:08:08 von Dirk Reiners

Hi Everybody,

I'm having some trouble setting up my Trac (trac.edgewall.org) server. I'm using
apache and mod_python running Trac 0.11.6 over https, and everything seems to
work fine. The only problem is that the Edit pages (when you click 'Edit this
page') have the standard "access+1d" expiration, so if I try to edit the same
page again I get the old, cached version of it, which obviously doesn't work.

I tried to manually change the expiration by adding the following to my
block:


SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
SetEnv PYTHON_EGG_CACHE /var/trac/eggs
PythonOption TracEnv /var/www/html/project
PythonOption TracUriRoot /project

ExpiresActive On

ExpiresDefault "access+1s"
Header set Cache-control "no-cache"


Order Allow,Deny
Allow from all
AuthType Basic
AuthName "Project Trac"
AuthUserFile /var/www/trac.htpasswd


But when I try to access an edit page I get the following HTTP headers:

https://xxx/yyy/wiki/Test/IncludePage4?action=edit

GET /yyy/wiki/Test/IncludePage4?action=edit HTTP/1.1
Host: external.lite3d.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091216
Fedora/3.5.6-1.fc11 Firefox/3.5.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: trac_auth=222c8b1f1e7aed68429276a8a85adf97;
trac_form_token=7372191226417b9d5480ecaa;
__utma=188037116.136402090.1263196685.1266295477.1266548406. 51;
__utmz=188037116.1266216773.47.5.utmcsr=zzz|utmccn=(referral )|utmcmd=referral|utmcct=/wiki/About;
PHPSESSID=u071vjsiu89vpjtqddkk683dh6; trac_form_token=54af8a56aa3664f8f238fc64;
__utmc=188037116; __utmb=188037116.35.10.1266548406

HTTP/1.x 200 OK
Date: Fri, 19 Feb 2010 02:27:07 GMT
Server: Apache/2.2.8 (Fedora)
Cache-Control: must-revalidate, max-age=86400
Content-Length: 7101
Expires: Sat, 20 Feb 2010 02:27:07 GMT
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html;charset=utf-8

Which have the same, wrong settings. :(

Can anybody give me a hint on what I might be doing wrong? How can I debug
Expires rules to see if the rule is applied at all?

Any hints welcome

Dirk

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Problem with Expires

am 08.03.2010 07:01:39 von Igor Cicimov

--001485e8edde6eb463048143cc43
Content-Type: text/plain; charset=ISO-8859-1

Probably your FilesMatch statement doesn't work, looks weird to me like you
are trying to match the against the query string not the file name. What
kind of files are you trying to match?

This is example of mod_expire usage per content type and file name that
might help you


ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/gif "access plus 7200 seconds"
ExpiresByType image/png "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 3600 seconds"
ExpiresByType text/css "access plus 3600 seconds"
ExpiresByType text/javascript "access plus 3600 seconds"
ExpiresByType application/x-shockwave-flash "access plus 3600
seconds"
ExpiresByType video/x-flv "access plus 3600 seconds"
ExpiresByType application/pdf "modification plus 3600 seconds"

ExpiresDefault "access plus 3600 seconds"



Cheers,
Igor

On Mon, Mar 8, 2010 at 4:08 PM, Dirk Reiners wrote:

>
> Hi Everybody,
>
> I'm having some trouble setting up my Trac (trac.edgewall.org) server. I'm
> using apache and mod_python running Trac 0.11.6 over https, and everything
> seems to work fine. The only problem is that the Edit pages (when you click
> 'Edit this page') have the standard "access+1d" expiration, so if I try to
> edit the same page again I get the old, cached version of it, which
> obviously doesn't work.
>
> I tried to manually change the expiration by adding the following to my
> block:
>
>
> SetHandler mod_python
> PythonInterpreter main_interpreter
> PythonHandler trac.web.modpython_frontend
> SetEnv PYTHON_EGG_CACHE /var/trac/eggs
> PythonOption TracEnv /var/www/html/project
> PythonOption TracUriRoot /project
>
> ExpiresActive On
>
> ExpiresDefault "access+1s"
> Header set Cache-control "no-cache"
>

>
> Order Allow,Deny
> Allow from all
> AuthType Basic
> AuthName "Project Trac"
> AuthUserFile /var/www/trac.htpasswd
>

>
> But when I try to access an edit page I get the following HTTP headers:
>
> https://xxx/yyy/wiki/Test/IncludePage4?action=edit
>
> GET /yyy/wiki/Test/IncludePage4?action=edit HTTP/1.1
> Host: external.lite3d.com
> User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6)
> Gecko/20091216
> Fedora/3.5.6-1.fc11 Firefox/3.5.6
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Cookie: trac_auth=222c8b1f1e7aed68429276a8a85adf97;
> trac_form_token=7372191226417b9d5480ecaa;
> __utma=188037116.136402090.1263196685.1266295477.1266548406. 51;
>
> __utmz=188037116.1266216773.47.5.utmcsr=zzz|utmccn=(referral )|utmcmd=referral|utmcct=/wiki/About;
> PHPSESSID=u071vjsiu89vpjtqddkk683dh6;
> trac_form_token=54af8a56aa3664f8f238fc64;
> __utmc=188037116; __utmb=188037116.35.10.1266548406
>
> HTTP/1.x 200 OK
> Date: Fri, 19 Feb 2010 02:27:07 GMT
> Server: Apache/2.2.8 (Fedora)
> Cache-Control: must-revalidate, max-age=86400
> Content-Length: 7101
> Expires: Sat, 20 Feb 2010 02:27:07 GMT
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Content-Type: text/html;charset=utf-8
>
> Which have the same, wrong settings. :(
>
> Can anybody give me a hint on what I might be doing wrong? How can I debug
> Expires rules to see if the rule is applied at all?
>
> Any hints welcome
>
> Dirk
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--001485e8edde6eb463048143cc43
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Probably your FilesMatch statement doesn't work, looks weird to me like=
you are trying to match the against the query string not the file name. Wh=
at kind of files are you trying to match?

This is example of mod_exp=
ire usage per content type and file name that might help you


<IfModule mod_expires.c>
      =A0 ExpiresActive O=
n
      =A0 ExpiresDefault "access plus 1 seconds"=

      =A0 ExpiresByType image/gif "access plus 7200 se=
conds"
      =A0 ExpiresByType image/png "access p=
lus 7200 seconds"

      =A0 ExpiresByType image/jpg "access plus 3600 second=
s"
      =A0 ExpiresByType text/css "access plus 3=
600 seconds"
      =A0 ExpiresByType text/javascript &q=
uot;access plus 3600 seconds"

      =A0 ExpiresByType application/x-shockwave-flash "acc=
ess plus 3600 seconds"
      =A0 ExpiresByType video/x-=
flv "access plus 3600 seconds"
      =A0 ExpiresBy=
Type application/pdf "modification plus 3600 seconds"

      =A0 <FilesMatch "\.js$">
    =
          =A0 ExpiresDefault "access plus 3600 sec=
onds"
      =A0 </FilesMatch>
</IfModule>=
;

Cheers,
Igor


On Mon, Mar 8, 2010 at 4:08 PM, Dirk Reiners < =3D"mailto:dirk.reiners@gmail.com">dirk.reiners@gmail.com> wr=
ote:
x; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


=A0 =A0 =A0 =A0Hi Everybody,



I'm having some trouble setting up my Trac ( wall.org" target=3D"_blank">trac.edgewall.org) server. I'm using ap=
ache and mod_python running Trac 0.11.6 over https, and everything seems to=
work fine. The only problem is that the Edit pages (when you click 'Ed=
it this page') have the standard "access+1d" expiration, so i=
f I try to edit the same page again I get the old, cached version of it, wh=
ich obviously doesn't work.




I tried to manually change the expiration by adding the following to my

<Directory> block:



<Directory /var/www/html/project>

=A0 =A0SetHandler mod_python

=A0 =A0PythonInterpreter main_interpreter

=A0 =A0PythonHandler trac.web.modpython_frontend

=A0 =A0SetEnv PYTHON_EGG_CACHE /var/trac/eggs

=A0 =A0PythonOption TracEnv /var/www/html/project

=A0 =A0PythonOption TracUriRoot /project



=A0 =A0ExpiresActive On

=A0 =A0<FilesMatch ".*action=3Dedit$">

=A0 =A0 =A0ExpiresDefault "access+1s"

=A0 =A0 =A0Header set Cache-control "no-cache"

=A0 =A0</FilesMatch>



=A0 =A0Order Allow,Deny

=A0 =A0Allow from all

=A0 =A0AuthType Basic

=A0 =A0AuthName "Project Trac"

=A0 =A0AuthUserFile /var/www/trac.htpasswd

</Directory>



But when I try to access an edit page I get the following HTTP headers:



_blank">https://xxx/yyy/wiki/Test/IncludePage4?action=3Dedit



GET /yyy/wiki/Test/IncludePage4?action=3Dedit HTTP/1.1

Host: external.lit=
e3d.com


User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/200=
91216

Fedora/3.5.6-1.fc11 Firefox/3.5.6

Accept: text/html,application/xhtml+xml,application/xml;q=3D0.9,*/*; q=3D0.8=


Accept-Language: en-us,en;q=3D0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.7

Keep-Alive: 300

Connection: keep-alive

Cookie: trac_auth=3D222c8b1f1e7aed68429276a8a85adf97;

trac_form_token=3D7372191226417b9d5480ecaa;

__utma=3D188037116.136402090.1263196685.1266295477.126654840 6.51;

__utmz=3D188037116.1266216773.47.5.utmcsr=3Dzzz|utmccn=3D(re ferral)|utmcmd=
=3Dreferral|utmcct=3D/wiki/About;

PHPSESSID=3Du071vjsiu89vpjtqddkk683dh6; trac_form_token=3D54af8a56aa3664f8f=
238fc64;

__utmc=3D188037116; __utmb=3D188037116.35.10.1266548406



HTTP/1.x 200 OK

Date: Fri, 19 Feb 2010 02:27:07 GMT

Server: Apache/2.2.8 (Fedora)

Cache-Control: must-revalidate, max-age=3D86400

Content-Length: 7101

Expires: Sat, 20 Feb 2010 02:27:07 GMT

Keep-Alive: timeout=3D15, max=3D100

Connection: Keep-Alive

Content-Type: text/html;charset=3Dutf-8



Which have the same, wrong settings. :(



Can anybody give me a hint on what I might be doing wrong? How can I debug =
Expires rules to see if the rule is applied at all?



Any hints welcome



=A0 =A0 =A0 =A0Dirk



------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g" target=3D"_blank">users-unsubscribe@httpd.apache.org

=A0" =A0 from the digest: httpd.apache.org" target=3D"_blank">users-digest-unsubscribe@httpd.apache.o=
rg


For additional commands, e-mail: org" target=3D"_blank">users-help@httpd.apache.org






--001485e8edde6eb463048143cc43--

Re: Problem with Expires

am 08.03.2010 07:29:00 von Dirk Reiners

Hi Igor,

On 03/08/2010 12:01 AM, Igor Cicimov wrote:
> Probably your FilesMatch statement doesn't work, looks weird to me like you
> are trying to match the against the query string not the file name. What
> kind of files are you trying to match?

the problem is that I can't match against file types. The whole system is a
Wiki. The default case is just displaying the wiki page, and I'm fine with
caching that one. I want to expire the case when a page is edited (which can be
detected based on whether the '?action=edit' part is added. That is really the
only difference between URLs I want to cache and the ones I don't want to cache...

If I understand you right the query part is not used for matching the Expires
rules by default? Is there a way to make it do that?

If there isn't I guess I'll have to resort to not caching any of the Wiki pages.
That's going to be more load on the server, but given that it is only in the
non-public part of the site it should be acceptable. However that opens another
problem: is there and easy way to have an Expires rule for all URL that do not
have an extension? I still would like to cache images and such, but I'd rather
not add specific rules for each possible file extension.

Thanks!

Dirk

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org